//@author A0080442N
#pragma once
#ifndef PREVIOUSACTION_H_
#define PREVIOUSACTION_H_

#include "Task.h"
#include "TaskItGlobal.h"

//This class is a container that stores the action that a user has done to modify 
//TaskItStorage in anyway. These actions include: add, block, delete, edit, mark, unmark, confirm.
//It also contains critical information, the modified task and its index,
//that is required to facilitate the undo function.
class PreviousAction {
private:
	CommandType _previousCommandType;
	Task _previousTask;
	int _previousItemNumber;
	vector <Task> _previousConfirmTasks;

public:
	PreviousAction();

	//Updates the object with the user command, modified task and its index in TaskItStorage.
	//Pre-Req:User command type, task that is modified and its index in TaskItStorage.
	//Post-Req: Updates the private attributes, _previousCommandType, _previousTask
	//			and _previousItemNumber.
	void updateTask(CommandType command, Task previous, int itemNumber);
	//When the user command is confirm, a list of deleted tasks needs to be stored.
	//When given a task, it stores that task to the vector _previousConfirmTasks.
	//Pre-Req: Only used when the user command is confirm and the task deleted.
	//Post-Req: Push back the task to the vector _previousConfirmTasks.
	void addToPreviousConfirmTasks(Task previous);
	//Clears the _previousConfirmTasks vector.
	//Pre-Req: None.
	//Post-Req: Clears the _previousConfirmTasks vector.
	void clearVector();
	
	//This is the getter function to get the CommandType _previousCommandType.
	//Pre-Req: None.
	//Post-Req: Returns the CommandType _previousCommandType.
	CommandType getPreviousCommandForUndo();
	//This is the getter function to get the vector <Task> _previousConfirmTasks.
	//Pre-Req: None.
	//Post-Req: Returns the vector <Task> _previousConfirmTasks.
	vector<Task> getPreviousConfirmTasks();
	//This is the getter function to get the Task _previousTask.
	//Pre-Req: None.
	//Post-Req: Returns the Task _previousTask.
	Task getPreviousTask();
	//This is the getter function to get the int _previousItemNumber.
	//Pre-Req: None.
	//Post-Req: Returns the int _previousItemNumber.
	int getPreviousItemNumber();
};

#endif
